package com.yundingai.mapper;

import com.yundingai.domain.entity.Subject;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SubjectMapper {


    //查询所有学科信息
    @Select("select * from study_subject")
    List<Subject> selectAllSubject();

    //新增学科信息
    @Insert("insert into study_subject(subject_name) values(#{subjectName})")
    @Options(useGeneratedKeys = true,keyProperty = "subjectId")
    void insertSubject(Subject subject);

    //更新学科信息
    @Update("update study_subject set subject_name = #{subjectName} where subject_id = #{subjectId}")
    void updateSubject(Subject subject);

    //根据学科名查询学科信息
    @Select("select * from study_subject where subject_name = #{subjectName}")
    Subject selectSubjectByName(String subjectName);
}
